package com.pkk.penguin.frame.know.java.interview.year2021.atguigu_20210226.strings;

import org.junit.Test;

/**
 * 字符串常量池的测试
 *
 * @author peikunkun
 * @version V1.0
 * @date 2021-02-26 11:40
 **/
public class StringTest {


  @Test
  public void Administrator_14_20210226114049_() {
    System.out.println("欢迎使用单元测试方法【Administrator_14()_20210226114049】");
    System.out.println("此方法测试描述：【这里我们注意,java,1.8.0_191在执行(str3 == str3.intern())时返回的是false，原因是sun.misc.Version已经将】");
    final String str1 = new StringBuilder("58").append("tongcehng").toString();
    System.out.println(str1);
    System.out.println(str1.intern());
    System.out.println(str1 == str1.intern());

    final String str2 = new StringBuilder("ja").append("va").toString();
    System.out.println(str2);
    System.out.println(str2.intern());
    System.out.println(str2 == str2.intern());

    final String str3 = new StringBuilder("1.8.0_").append("191").toString();
    System.out.println(str3);
    System.out.println(str3.intern());
    System.out.println(str3 == str3.intern());

    System.out.println("test".intern());
  }


}
